package com.dkd.manage.validator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.dkd.manage.mapper.NodeMapper;

/**
 * 数据完整性校验器（无物理外键场景）
 */
@Component
public class IntegrityValidator {

    @Autowired
    private NodeMapper nodeMapper;

    /** 区域是否被点位引用 */
    public boolean isRegionReferenced(Long regionId) {
        return nodeMapper.countByRegionId(regionId) > 0;
    }

    /** 合作商是否被点位引用 */
    public boolean isPartnerReferenced(Long partnerId) {
        return nodeMapper.countByPartnerId(partnerId) > 0;
    }
}